import React, { createContext } from "react"

const AppContext = createContext<IContext>({} as IContext)

export function AppContextProvider({children}:Children) {
  const [context, setContext] = React.useState<Record<string, any>>([])
  const val:IContext = {context, setContext} as IContext

  return <AppContext.Provider value={val}>{children}</AppContext.Provider>
}

export function useAppContext(){
  return React.useContext(AppContext)
}